--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit ceffbbd290f7a0287aace4adfc63132c7e4df3f9
Parents : 345f3c5
Author : Mark Qvist <bc7291552be7a58f361522990465165c>
Signature : T66BB85Valid, signed by author
Date : 2026-07-21T02:13:11+02:00
Added interface telemetry example
Changes
1 files changed, 111 insertions(+), 0 deletions(-)
Diff
diff --git a/docs/example_plugins/interface_telemetry.py b/docs/example_plugins/interface_telemetry.py
new file mode 100644
index 00000000..19653f20
--- /dev/null
+++ b/docs/example_plugins/interface_telemetry.py
@@ -0,0 +1,111 @@
+# This is a telemetry plugin that publishes
+# connectable interfaces, similarly to the
+# interface discovery built into RNS. Using
+# telemetry-based interface publishing allows
+# private interface distribution or querying,
+# so this can be useful for networks where you
+# only want a handful of people to have access
+# to your interfaces. Interfaces published
+# using this plugin will show up in Sideband's
+# situation map.
+
+import RNS
+
+class InterfaceTelemetryPlugin(SidebandTelemetryPlugin):
+ plugin_name = "interface_telemetry"
+
+ def start(self):
+ # Do any initialisation work here
+ RNS.log("Interface telemetry plugin starting...")
+
+ # And finally call start on superclass
+ super().start()
+
+ def stop(self):
+ # Do any teardown work here
+ pass
+
+ # And finally call stop on superclass
+ super().stop()
+
+ def update_telemetry(self, telemeter):
+ if telemeter != None:
+ if not "interfaces" in telemeter.sensors:
+ # Create interface sensor if it is not already
+ # enabled in the running telemeter instance
+ telemeter.synthesize("interfaces")
+ sensor = telemeter.sensors["interfaces"]
+
+ # Let's add a connectable RNode interface
+ name = "Test RNode"
+ frequency = 868e6
+ bandwidth = 125e3
+ codingrate = 6
+ spreadingfactor = 8
+ lat = 41.90215
+ lon = 12.45339
+ height = 62.7
+
+ # It's important to use the actual transport ID
+ # of the Reticulum Transport Instance that the
+ # interface is attached to. The example below
+ # gets the ID from this node, but if you are
+ # publishing an interface running on another
+ # node, you will have to manually specify the
+ # correct transport ID here.
+ transport_id = RNS.hexrep(RNS.Transport.identity.hash, delimit=False)
+
+ # It's safe to call add_interface multiple times
+ # with the same name. Doing so will update the
+ # data associated with the interface.
+ sensor.add_interface(type="RNodeInterface", name=name, transport_id=transport_id, transport=True,
+ frequency=frequency, bandwidth=bandwidth, codingrate=codingrate, spreadingfactor=spreadingfactor,
+ lat=lat, lon=lon, height=height)
+
+ # Here's an example of a WeaveInterface
+ name = "Local Uplink"
+ channel = 11
+ frequency = 2462e6
+ bandwidth = 20e6
+ modulation = "w80211"
+ lat = 51.99768
+ lon = -0.74002
+ height = 12
+
+ sensor.add_interface(type="WeaveInterface", name=name, transport_id=transport_id, transport=True,
+ frequency=frequency, bandwidth=bandwidth, channel=channel, modulation=modulation,
+ lat=lat, lon=lon, height=height)
+
+ # Here's an example of a KISSInterface
+ name = "UHF"
+ frequency = 433e6
+ modulation = "OFDM"
+ lat = 51.50839
+ lon = -0.07606
+ height = 2.0
+
+ sensor.add_interface(type="KISSInterface", name=name, transport_id=transport_id, transport=True,
+ frequency=frequency, modulation=modulation, lat=lat, lon=lon, height=height)
+
+ # Here's an example of a BackboneInterface
+ name = "My Network"
+ host = "rns.my.network"
+ port = 4242
+ ifac_netname = "my_network"
+ ifac_netkey = "the_secret"
+ lat = 29.97251
+ lon = 31.12828
+ height = 72
+
+ sensor.add_interface(type="BackboneInterface", name=name, transport_id=transport_id, transport=True,
+ reachable_on=host, port=port, lat=lat, lon=lon, height=height,
+ ifac_netname=ifac_netname, ifac_netkey=ifac_netkey)
+
+ # That's it, the interfaces will now show up on
+ # the map of instances that can receive the
+ # telemetry.
+
+
+# Finally, tell Sideband what class in this
+# file is the actual plugin class.
+plugin_class = InterfaceTelemetryPlugin
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────